package com.qingke.qkmall.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;

public class DateConverter implements Converter<String, Date>{

	@Override
	public Date convert(String source) {
		try {
			if(source == null || source.trim().equals("")) {
				return null;
			}
			DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
			Date date = df.parse(source);
			return date;
		} catch(Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}

}
